package com.course.entity;

public class Teacher extends Person {
    private Course taughtCourse;  // 特有属性：教授课程

    // 子类构造方法：调用父类构造+初始化特有属性
    public Teacher(String teacherId, String name, String gender, Course taughtCourse) {
        super(teacherId, name, gender);  // 初始化id、name、gender
        this.taughtCourse = taughtCourse;
    }

    // 重写父类抽象方法：打印教师授课信息
    @Override
    public void printWorksheet() {
        System.out.println("教师工作单---");
        System.out.println("教师编号：" + id);  // 访问父类protected属性id
        System.out.println("教授课程：" + taughtCourse.getCourseName());
        System.out.println("上课地点：" + taughtCourse.getLocation());
        System.out.println("上课时间：" + taughtCourse.getTime());
    }

    public Course getTaughtCourse() {
        return taughtCourse;
    }
}